package com.example.demo.dao;

import com.example.demo.entity.Student;
import com.example.demo.entity.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public class TeacherDaoImpl implements TeacherDao{
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Override
    public List<Teacher> getAllTeacher() {
        String sql="select * from teacher";
        return jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(Teacher.class));
    }

}
